#include "electrolyzerdlg.h"
#include "ui_electrolyzerdlg.h"
#include "sys_config.h"
#include "mainwindow.h"

ElectrolyzerDlg::ElectrolyzerDlg(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ElectrolyzerDlg)
{
    ui->setupUi(this);

    ui->label_tip->setFont(QFont(SYS_FONT_TYPE, FONT_SIZE_20));
    ui->label_size->setFont(QFont(SYS_FONT_TYPE, FONT_SIZE_20));
    ui->comboBox_size->setFont(QFont(SYS_FONT_TYPE, FONT_SIZE_20));
    ui->buttonBox->setFont(QFont(SYS_FONT_TYPE, FONT_SIZE_20));
    ui->label_mode->setFont(QFont(SYS_FONT_TYPE, FONT_SIZE_20));
    ui->radioButton_pcba->setFont(QFont(SYS_FONT_TYPE, FONT_SIZE_20));
    ui->radioButton_product->setFont(QFont(SYS_FONT_TYPE, FONT_SIZE_20));
    ui->radioButton_pcba->setChecked(true);
    ui->radioButton_product->setChecked(false);
    ui->comboBox_size->setCurrentIndex(2);
    ui->keep_setting->setFont(QFont(SYS_FONT_TYPE, FONT_SIZE_20));
    ui->keep_setting->setChecked(false);
    ui->cb_orpEnable->setFont(QFont(SYS_FONT_TYPE, FONT_SIZE_20));
    ui->cb_orpEnable->setChecked(true);
    ui->cb_phEnable->setFont(QFont(SYS_FONT_TYPE, FONT_SIZE_20));
    ui->cb_phEnable->setChecked(true);
    ui->cb_waterTemp->setFont(QFont(SYS_FONT_TYPE, FONT_SIZE_20));
    ui->cb_waterTemp->setChecked(true);
#if (EN_LANGUAGE_ENGLISH == 1)
setWindowTitle(tr("Choose the electrolytic cell model"));
    ui->label_tip->setText(tr("Tip:Please select electrolytic cell model"));
    ui->label_mode->setText(tr("Test mode:"));
    ui->label_size->setText(tr("Cell model:"));
    ui->radioButton_pcba->setText(tr("PCBA mode"));
    ui->radioButton_pcba->setChecked(false);
    ui->radioButton_pcba->setDisabled(true);
    ui->radioButton_product->setChecked(true);
    ui->radioButton_product->setText(tr("Machine mode"));
    ui->keep_setting->setText(tr("Keep test parameters in effect!"));
#endif
}

ElectrolyzerDlg::~ElectrolyzerDlg()
{
    delete ui;
}

int ElectrolyzerDlg::GetTestMode(void)
{
    if (ui->radioButton_pcba->isChecked()){
        return 0;
    } else {
        return 1;
    }
}

int ElectrolyzerDlg::GetKeepSettingFlag(void)
{
    if (ui->keep_setting->isChecked()) {
        return 1;
    } else {
        return 0;
    }
}

int ElectrolyzerDlg::GetElectrolyzerSize(void)
{
    int ret;
    int size[] = {
        ELECTROLYTIC_STRIP_1,
        ELECTROLYTIC_STRIP_2,
        ELECTROLYTIC_STRIP_3,
        ELECTROLYTIC_STRIP_4,
        ELECTROLYTIC_STRIP_5,
        ELECTROLYTIC_STRIP_6,
        ELECTROLYTIC_STRIP_7
    };

    ret = size[ui->comboBox_size->currentIndex()];

    return ret;
}


bool ElectrolyzerDlg::ORP_Enable_Get(void)
{
    return ui->cb_orpEnable->checkState();
}
bool ElectrolyzerDlg::PH_Enable_Get(void)
{
    return ui->cb_phEnable->checkState();
}
bool ElectrolyzerDlg::WaterTemp_Enable_Get(void)
{
    return ui->cb_waterTemp->checkState();
}
